I want to plot the final accuracy plots for the emulators, and break that down as a function of


In [1]:
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
import matplotlib.colors as colors

In [2]:
import numpy as np
from glob import glob
from os import path

In [3]:
#shape_noise_covmat = np.load('/u/ki/swmclau2/Git/pearce/bin/covmat/shape_noise.npy')
shape_noise_covmat = np.load('./Hankel_transform/shape_noise.npy')

In [4]:
rp_bins = np.logspace(-1.0, 1.6, 19)
#cic_bins = np.round(np.r_[np.linspace(1, 9, 8), np.round(np.logspace(1,2, 7))] )

In [5]:
rp_points = (rp_bins[1:]+rp_bins[:-1])/2.0
#cic_points = (cic_bins[1:]+cic_bins[:-1])/2.0

In [6]:
full_cov = np.load('/home/users/swmclau2/Git/pearce/bin/covmat/wp_ds_full_covmat.npy')#, full_cov[:36][:, :36])
#np.save('/home/users/swmclau2/Git/pearce/bin/covmat/wp_full_covmat.npy', full_cov[:18][:, :18])
#np.save('/home/users/swmclau2/Git/pearce/bin/covmat/ds_full_covmat.npy', full_cov[18:36][:, 18:36])
cov = np.load('/home/users/swmclau2/Git/pearce/bin/covmat/wp_ds_sim_covmat.npy')#, cov[:36][:, :36])

In [7]:
#emu covs
emu_cov_fnames = ['/home/users/swmclau2/Git/pearce/bin/optimization/wp_hod_emu_cov_lpw.npy',
                  '/home/users/swmclau2/Git/pearce/bin/optimization/ds_hod_emu_cov_lpw.npy']

In [8]:
emu_cov = np.zeros_like(full_cov[:36][:, :36])

for i, fname in enumerate(emu_cov_fnames):
    
    emu_cov[i*18:(i+1)*18][:, i*18:(i+1)*18] = np.load(fname)

In [9]:
def cov_to_corr(cov):
    std = np.sqrt(np.diag(cov))
    
    denom = np.outer(std, std)
    
    return cov/denom

In [10]:
emu_corr = cov_to_corr(emu_cov)

In [11]:
cmap = sns.diverging_palette(240, 10, n=7, as_cmap = True)

In [12]:
plt.imshow(cov_to_corr(cov), cmap = cmap, vmin = -1)


Out[12]:
<matplotlib.image.AxesImage at 0x7fa49059fc50>

In [13]:
plt.imshow(cov_to_corr(full_cov), cmap = cmap, vmin = -1)


Out[13]:
<matplotlib.image.AxesImage at 0x7fa4900d0c90>

In [14]:
plt.imshow(emu_corr, cmap = cmap, vmin = -1)


Out[14]:
<matplotlib.image.AxesImage at 0x7fa45cfafdd0>

In [15]:
full_emu_cov = full_cov[:36][:, :36] + emu_cov

In [16]:
full_emu_corr = cov_to_corr(full_emu_cov)

In [17]:
plt.imshow(full_emu_corr, cmap = cmap, vmin = -1)


Out[17]:
<matplotlib.image.AxesImage at 0x7fa459566dd0>

In [18]:
plt.plot(rp_points, np.sqrt(np.diag(full_emu_cov[:18, :18]) ), label = 'wp', color = 'b')
plt.plot(rp_points, np.sqrt(np.diag(cov[:18, :18]) ), color = 'b', ls = '--')
plt.plot(rp_points, np.sqrt(np.diag(emu_cov[:18, :18]) ), color = 'b', ls = ':')


#plt.plot(rp_points, np.sqrt(np.diag(cov[18:36, 18:36]) ), label = 'ds')
plt.plot(rp_points, np.sqrt(np.diag(full_emu_cov[18:36, 18:36])) , label = 'ds', color ='r')
plt.plot(rp_points, np.sqrt(np.diag(cov[18:36, 18:36]) ),  color = 'r', ls = '--')
plt.plot(rp_points, np.sqrt(np.diag(emu_cov[18:36, 18:36]) ), color = 'r', ls = ':')
plt.plot(rp_points, np.sqrt(np.diag(shape_noise_covmat)), color = 'r',  ls = '-.')

#plt.ylabel('Delta Sigma Unc')
plt.xlabel('r [Mpc]')
plt.loglog()
plt.legend(loc='best')


Out[18]:
<matplotlib.legend.Legend at 0x7fa4593cfe10>

In [19]:
#plt.plot(rp_points, np.sqrt(np.diag(cov[18:36, 18:36]) ), label = 'ds')
plt.plot(rp_points, np.sqrt(np.diag(full_emu_cov[18:36, 18:36])) , label = 'Total', color ='k')
plt.plot(rp_points, np.sqrt(np.diag(cov[18:36, 18:36]) ),  color = 'g', label = 'Sim', ls = '--')
plt.plot(rp_points, np.sqrt(np.diag(emu_cov[18:36, 18:36]) ), color = 'r', ls = ':', label = 'Emu')
plt.plot(rp_points, np.sqrt(np.diag(shape_noise_covmat)), color = 'b', label = 'Shape Noise',ls = '-.')
#plt.plot(rp_points, np.sqrt(np.diag(full_cov[18:36, 18:36])), color = 'm')

plt.ylabel('Delta Sigma Unc')
plt.xlabel('r [Mpc]')
plt.loglog()
plt.legend(loc='best')


Out[19]:
<matplotlib.legend.Legend at 0x7fa4590bd910>